/*
 * Alloy Analyzer
 * Copyright (c) 2002 Massachusetts Institute of Technology
 *
 * The Alloy Analyzer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The Alloy Analyzer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the Alloy Analyzer; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package alloy.ast;

/**
   provides basic implementation of methods in Formula
*/
abstract class AbstractFormula extends TreeNode implements Formula {

    public AbstractFormula(Location location_) {
        super(location_);
    }
    
    public AbstractFormula(Location location_, Node n1_) {
        super(location_, n1_);
    }


    public AbstractFormula(Node n1_) {
        super(Location.UNKNOWN, n1_);
    }


    
    public AbstractFormula(Location location_, Node n1_, Node n2_) {
        super(location_, n1_, n2_);
    }


    public AbstractFormula(Node n1_, Node n2_) {
        super(Location.UNKNOWN, n1_, n2_);
    }


    
    public AbstractFormula(Location location_, Node n1_, Node n2_, Node n3_) {
        super(location_, n1_, n2_, n3_);
    }


    public AbstractFormula(Node n1_, Node n2_, Node n3_) {
        super(Location.UNKNOWN, n1_, n2_, n3_);
    }
    
    public Formula and(Formula other_) {
        return new BinaryFormula(this, LogicOp.AND, other_);
    }

    public Formula or(Formula other_) {
        return new BinaryFormula(this, LogicOp.OR, other_);
    }

    public Formula iff(Formula other_) {
        return new BinaryFormula(this, LogicOp.IFF, other_);
    }

    public Formula not() {
        return new NegFormula(this);
    }

    public Formula implies(Formula other_, Formula else_) {
        return new ImplicationFormula(this, other_, else_);
    }
    
    public Formula implies(Formula other_) {
    	return implies(other_, new EmptyFormula());
    }
}
